package JLB_Chapter_10;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;

public class code_10_05 {
    public static void main(String[] args) {
        Queue<String> queue = new LinkedList<String>();
        // 添加元素
        queue.offer("a");
        queue.offer("b");
        queue.offer("c");
        queue.offer("d");
        queue.offer("e");
        Iterator<String> iterator = queue.iterator();
        while (iterator.hasNext()) {
            System.out.print(iterator.next() + "\n");
        }
        System.out.println("poll=" + queue.poll());
        Iterator<String> iterator1 = queue.iterator();
        while (iterator1.hasNext()) {
            System.out.print(iterator1.next() + "\n");
        }
        System.out.println("element=" + queue.element());
        System.out.println("peek=" + queue.peek());
    }
}
